//
//  UIImageView+JSDownload.h
//  IJSOCproject
//
//  Created by shange on 2017/5/20.
//  Copyright © 2017年 jinshan. All rights reserved.
//

#import <UIKit/UIKit.h>

#import <SDWebImageManager.h>

typedef NS_ENUM(NSUInteger, shapeType) {
    circleType = 0,
    squareType,
    triangleType,
};


@interface UIImageView (JSDownload)

/**
 *  根据上下文绘制图片
 *
 *  @param imageRect 绘制区域
 *
 *  @return 绘制好的图片
 */
- (UIImage *)getImageFromUIGraphics:(CGRect)imageRect;

/**
 *  根据网络状态自动加载网络图片
 *
 *  @param originURL 原始图
 *  @param thumbnailUrl 缩略图
 *  @param placeholder 占位图
 *   @param completedBlock 返回原始图片和链接地址
 */
- (void)setOriginImageFromURL:(NSString *)originURL thumbnailImage:(NSString *)thumbnailUrl placeholder:(UIImage *)placeholder completed:(SDExternalCompletionBlock)completedBlock;

/**
 *  给UIImageView设置各种形状的图片
 *
 *  @param originImage 原始图链接
  *  @param placeholder 占位图
  *  @param shapeType 图片形状
 *
 */
- (void)setCircleImageFromOriginImage:(NSString *)originImage placedolder:(UIImage *)placeholder shapeType:(shapeType)shapeType;


@end
